package cn.gz.sboot41.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AxiosController {
    @RequestMapping("/helloAxios")
    public String helloAxios(String info){
        System.out.println("收到请求了");
        return "收到请求了"+info;
    }

    @RequestMapping("/reg")
    public String reg(String username,String password){
        System.out.println("username = " + username + ", password = " + password);
        return "注册完成，恭喜"+username;
    }

    @RequestMapping("/check")
    public int check(String username){
        if("tom".equals(username)){
            return 2;//不可用
        }
        return 1;//可用
    }

    @RequestMapping("/test")
    public String test(double height,double weight){
        double bmi = weight/(height*height);
        if(bmi<18.5){
            return "偏瘦";
        }
        if(bmi<24){
            return "正常";
        }
        if(bmi<28){
            return "偏胖";
        }
       return "过胖";
    }

}
